#include "votesys.h"
#include<stdio.h>


int 
main(int argc, char** argv)
{
   CLIENT *cl;
   countList list;
   int i;
   int status;

   cl = clnt_create("localhost", VOTESYS, VOTEVERS, "tcp");

   if( cl == NULL )
   {
     /*fprintf(stderr, "Cannot connect to server!\n");*/
     clnt_pcreateerror("Server");
     return 1;
   }

   if( (status = results_1(NULL, &list, cl)) != RPC_SUCCESS )
   {
      clnt_perror(cl, "Server"); 
      return -1;
   }

   for(i=0; i<list.num; i++)
   {
     printf("%s - %d vote\n", list.array[i].name, list.array[i].count);
   }
   return 0; 
}
